package com.itheima.demo1;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class Demo1 {
    public static void main(String[] args) throws IOException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        FileReader fr = new FileReader("G:\\heina Day 1\\misao\\src\\porg.properties");
        Properties pt = new Properties();
        pt.load(fr);
        fr.close();

        String st = (String) pt.get("classname");
        Class clazz = Class.forName(st);
        Constructor constructor = clazz.getConstructor();
        Object o = constructor.newInstance();
        Method method = clazz.getMethod("eat");
        method.invoke(o);
    }
}
